package com.yuantu.judiciary.dao;

import com.yuantu.judiciary.model.domain.ExtractPointDO;

import com.yuantu.judiciary.model.domain.InviteCodeDO;
import com.yuantu.judiciary.model.enums.EndpointType;
import com.yuantu.judiciary.model.enums.ExtractPointState;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;


/**
 * 账号数据库操作
 *
 * @author syw
 * @since 2023-08-03
 **/
public interface IExtractPointDao extends JpaRepository<ExtractPointDO, Long> {

    @Query("select q from ExtractPointDO q where q.creatorId = :creatorId and (q.extractPointState = 'SUCCESS' or q.extractPointState = 'EXTRACTING') " +
            "and q.type = :type and q.deleted=false")
    List<ExtractPointDO> findExtractedPointByDeletedFalse(Long creatorId, EndpointType type);

    Page<ExtractPointDO> findAllByCreatorIdAndDeletedFalseOrderByCreateTimeDesc(Long creatorId, Pageable page);

    List<ExtractPointDO> findInfosByCreatorIdInAndDeletedFalse(List<Long> accountIds);
}
